<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
      .one{
        color: red;
      }
    </style>
    <!-- 引入vue3 js库 -->
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body>
    <div id="app">
        <!-- 使用三目运算符绑定样式 -->
    <div v-bind:class="userId==1?className:''"> DOM元素三目运算符绑定方式</div>
    </div>
    <script>
        Vue.createApp({
          data(){
            return {
              userId:2,
              className:'one'
            }
          }
        }).mount("#app")
    </script>
</body>
</html>

